Skip to content

Replace hardcoded percentages with values from a file#27

Open
ZuleykhaPavlichenkova-TomTom wants to merge 46 commits intoduckdb:mainfrom
ZuleykhaPavlichenkova-TomTom:random-values-from-file
Open

Replace hardcoded percentages with values from a file#27
ZuleykhaPavlichenkova-TomTom wants to merge 46 commits intoduckdb:mainfrom
ZuleykhaPavlichenkova-TomTom:random-values-from-file

Conversation

@ZuleykhaPavlichenkova-TomTom
Copy link
Copy Markdown
Contributor

This PR will replace hardcoded percentages from the fuzzer with values defined in a file, as it mentioned in the #23

Copy link
Copy Markdown
Member

@Tmonster Tmonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I don't think the RandomsConfig needs to be a friend class, instead you can make the RandomConfig a member of the StatementGenerator. Ie...

class StatementGenerator {
public:
    RandomsConfig percentage_selector;
}

Comment thread src/statement_generator.cpp Outdated
Comment thread src/statement_generator.cpp Outdated
Copy link
Copy Markdown
Member

@Tmonster Tmonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the RandomNumsConfig could be an unorderdered_map<percentages_enum, idx_t> ?

You will have to create an Enum (see duckdb/common/enums/logical_operator_type.hpp for an example).

In the future it will make it easier to manage the percentages, add new ones etc.

Comment thread src/random_nums_config.cpp Outdated
Copy link
Copy Markdown
Member

@Tmonster Tmonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much better.

looks like you don't use the file handle though.
Now you can start adding more percentages as well if you want. Feel free to create a GitHub actions file that runs the fuzzer with a config file and one without

Comment thread src/fuzzyduck.cpp Outdated
Comment thread src/include/fuzzyduck.hpp Outdated
Comment thread src/fuzzyduck.cpp Outdated
Comment thread src/random_nums_config.cpp Outdated
Copy link
Copy Markdown
Member

@Tmonster Tmonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just the one comment.

also, I can imagine you may end up adding many ENUMS for each case. You can also just create enums like RandomPercentagesEnum::DEFAULT_XX_PERCENT so that your enum library doesn't get insanely big. Eventually the enums in the statement generation code can get their own enums as we continue to work on and expand this functionality

Comment thread src/include/random_nums_config.hpp
Comment thread src/include/random_nums_config.hpp Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants